<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>商家管理系统</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="/layuiadmin/layui/css/layui.css"
	media="all">
<link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" type="text/css"
	href="/css/plugins/dropzone/basic.css" />
<link rel="stylesheet" type="text/css"
	href="/css/plugins/dropzone/dropzone.css" />
<link rel="stylesheet" type="text/css"
	href="/css/plugins/layui-formSelect/formSelects-v4.css" />
<style>
img {
	margin-left: 5px
}

.detail_title {
	font-weight: bold;
	color: black;
}

tr th {
	text-align: center !important;
}

tr td {
	text-align: center !important;
}

.seksqwjg {
	font-size: 1.2em;
	color: #ff6600;
}

.money li {
	text-align: right;
}

.layui-card-header .layui-icon {
    line-height: initial;
    position: absolute;
    left: -5px;
    top: 47%;
    margin-top: -7px;
}

.layui-card-header .goodsMoney {
    line-height: initial;
    position: absolute;
    right: 15px;
    top: 50%;
    margin-top: -7px;
}
</style>
</head>
<body>
	<div class="layui-col-md12">
		<div class="layui-card">
			<div class="layui-card-header">
				<div class="layui-col-md-offset11">
					<button class="layui-btn layui-btn-sm layui-btn-normal" onclick="history.go(-1)">返回上一页
					</button>
				</div>
			</div>
			<div class="layui-card-body">
				<div class="layui-container" style="margin-top: 20px">
					<div class="layui-card-body">
						<blockquote class="layui-elem-quote">当前订单状态：<span style="color: red;">${order.orderStatusName }</span></blockquote>
						
						<!-- 基本信息 -->
						<div class="layui-card-header"><i class="layui-icon layui-icon-note"></i>基本信息</div>
						<div class="layui-table-body layui-table-main">
							<table class="layui-table" lay-skin="row" lay-size="lg" lay-even="">
								<thead>
									<tr>
										<th><div class="layui-table-cell">订单编号</div></th>
										<th><div class="layui-table-cell">交易单号</div></th>
										<th><div class="layui-table-cell">用户账户</div></th>
										<th><div class="layui-table-cell">支付方式</div></th>
									</tr>
								</thead>
								<tbody>
									<tr>
										<td><div class="layui-table-cell">${order.orderCode }</div></td>
										<td><div class="layui-table-cell">${order.payCode }</div></td>
										<td><div class="layui-table-cell">${order.phone }</div></td>
										<td><div class="layui-table-cell">${order.payTypeName }</div></td>
									</tr>
									<tr>
										<th><div class="layui-table-cell">订单类型</div></th>
										<th><div class="layui-table-cell">订单来源</div></th>
										<th><div class="layui-table-cell">订单标签</div></th>
										<th><div class="layui-table-cell">优惠说明</div></th>
									</tr>
									<tr>
										<td><div class="layui-table-cell">${order.orderTypeName }</div></td>
										<td><div class="layui-table-cell">${order.orderFromChannel }</div></td>
										<td><div class="layui-table-cell">${order.label }</div></td>
										<td><div class="layui-table-cell">${order.proExplain }</div></td>
									</tr>
								</tbody>
							</table>
						</div>

						<!-- 物流信息 -->
						<div class="layui-card-header">
							<i class="layui-icon layui-icon-note"></i>物流信息
							<span style="color:red;">(选择物流发货且未收货的订单才能修改物流信息)</span>
						</div>
						<div class="layui-table-body layui-table-main">
							<table class="layui-table" lay-skin="row" lay-size="lg" lay-even="">
								<tbody>
								<tr>
									<th><div class="layui-table-cell">配送方式</div></th>
									<th><div class="layui-table-cell">物流公司</div></th>
									<th><div class="layui-table-cell">物流单号</div></th>
									<th><div class="layui-table-cell">发货仓库</div></th>
									<th><div class="layui-table-cell">操作</div></th>
								</tr>
								<c:forEach items="${order.expList}" var="e">
									<tr>
										<td><div class="layui-table-cell">${!empty e ? e.receivedTypeName : '' }</div></td>
										<td><div class="layui-table-cell">${!empty e ? e.expName : '' }</div></td>
										<td><div class="layui-table-cell">${!empty e ? e.expNo : '' }</div></td>
										<td><div class="layui-table-cell">${!empty e ? e.warehouseName : '' }</div></td>
										<td>
											<c:if test="${e.receivedType == 1 && (order.orderStatus == 15 || (order.orderStatus == 10 && e.status == 1)) }">
												<div class="layui-table-cell">
													<a class="layui-btn layui-btn-warm layui-btn-xs updateSendThis" data-oid="${order.id }" data-id="${e.id }" data-type="updateSendThis">修改</a>
												</div>
											</c:if>
										</td>
									</tr>
								</c:forEach>
								</tbody>
							</table>
						</div>
						
						<!-- 收货人信息 -->
						<div class="layui-card-header"><i class="layui-icon layui-icon-note"></i>收货人信息</div>
						<div class="layui-table-body layui-table-main">
							<table class="layui-table" lay-skin="row" lay-size="lg" lay-even="">
								<thead>
									<tr>
										<th><div class="layui-table-cell">收货人</div></th>
										<th><div class="layui-table-cell">手机号码</div></th>
										<th><div class="layui-table-cell">收货地址</div></th>
										<th><div class="layui-table-cell">订单备注</div></th>
										<c:if test="${order.orderStatus == 10 || order.orderStatus == 15 }">
											<th><div class="layui-table-cell">操作</div></th>
										</c:if>
									</tr>
								</thead>
								<tbody>
									<tr>
										<td><div class="layui-table-cell">${!empty order.expDetail ? order.expDetail.receiver : '' }</div></td>
										<td><div class="layui-table-cell">${!empty order.expDetail ? order.expDetail.phone : '' }</div></td>
										<td><div class="layui-table-cell">${!empty order.expDetail ? order.expDetail.addrPrefix : '' }${!empty order.expDetail ? order.expDetail.addressDetail : '' }</div></td>
										<td><div class="layui-table-cell">${order.remark }</div></td>
										<c:if test="${order.orderStatus == 10 || order.orderStatus == 15 }">
										<td>
										<div class="layui-table-cell">
										<a class="layui-btn layui-btn-warm layui-btn-xs updateReceiverThis" data-oid="${order.orderCode }" data-type="updateReceiverThis">修改</a>
										</div>
										</td>
										</c:if>
									</tr>
								</tbody>
							</table>
						</div>
						
						<!-- 商品信息 -->
						<div class="layui-card-header"><i class="layui-icon layui-icon-note"></i>商品信息</div>
						<div class="layui-table-body layui-table-main">
							<table class="layui-table" lay-size="lg">
								<thead>
									<tr>
										<th><div class="cell">商品图片</div></th>
										<th><div class="layui-table-cell">商品名称</div></th>
										<th><div class="layui-table-cell">规格信息</div></th>
										<th><div class="layui-table-cell">单价</div></th>
										<th><div class="layui-table-cell">数量</div></th>
										<th><div class="layui-table-cell">小计</div></th>
									</tr>
								</thead>
								<tbody>
									<c:forEach items="${order.details }" var="d">
										<tr>
											<td><div class="cell"><img src="${d.proUrl }" width="80px;" height="80px;"/></div></td>
											<td><div class="layui-table-cell">${d.proName }</div></td>
											<td><div class="layui-table-cell">${d.proSpecName }</div></td>
											<td>
                                        	<div class="layui-table-cell">
                                        		<c:choose>
                                        			<c:when test="${order.orderType==4 }">${d.point }</c:when>
                                        			<c:otherwise>${d.price }</c:otherwise>
                                        		</c:choose>
                                        	</div>
                                        </td>
                                        <td><div class="layui-table-cell">${d.qty }</div></td>
                                        <td>
                                        	<div class="layui-table-cell">
                                        		<c:choose>
                                        			<c:when test="${order.orderType==4 }">${d.qty*d.point }</c:when>
                                        			<c:otherwise>${d.point }</c:otherwise>
                                        		</c:choose>
                                        	</div>
                                        </td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
							<div class="layui-card-header">
								<span class="goodsMoney">商品合计：
		                            <span style="color: red;">
		                            	<c:choose>
		                           			<c:when test="${order.orderType==4 }">${order.point }</c:when>
		                           			<c:otherwise>${order.goodsMoney }</c:otherwise>
		                           		</c:choose>
		                           	</span>
	                           	</span>
							</div>
						</div>
						
						<!-- 金额信息 -->
						<div class="layui-card-header"><i class="layui-icon layui-icon-note"></i>金额信息</div>
						<div class="layui-table-body layui-table-main">
							<table class="layui-table" lay-skin="row" lay-size="lg" lay-even="">
								<thead>
									<tr>
										<th><div class="layui-table-cell">商品合计</div></th>
										<th><div class="layui-table-cell">运费</div></th>
										<th><div class="layui-table-cell">折扣金额</div></th>
										<th><div class="layui-table-cell">订单总额</div></th>
										<th><div class="layui-table-cell">应付款金额</div></th>
									</tr>
								</thead>
								<tbody>
									<tr>
										<td><div class="layui-table-cell">${order.goodsMoney }</div></td>
										<td><div class="layui-table-cell">${order.expMoney }</div></td>
										<td><div class="layui-table-cell">${order.discountMoney }</div></td>
										<td><div class="layui-table-cell">${order.realMoney }</div></td>
										<td><div class="layui-table-cell">${order.payMoney }</div></td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script src="/layuiadmin/layui/layui.js"></script>
	<script>
		layui.config({
			//静态资源所在路径
			base : '/layuiadmin/'
		}).extend({
			//主入口模块
			index : 'lib/index'
		}).use([ 'index', 'view' ], function() {
			var $ = layui.$, admin = layui.admin;
			var active = {
				updateSendThis : function(orderId, expDetailId) {
					layer.open({
						title : '修改发货信息',
						type : 2,
						area : [ '580px', '550px' ],
						content : '/order/orderUpdateExp?orderId='+orderId+'&id='+ expDetailId
					});
				},
				updateReceiverThis : function(orderId, expDetailId) {
					layer.open({
						title : '修改收货信息',
						type : 2,
						area : [ '580px', '550px' ],
						content : '/order/orderUpdateReceive?orderCode='+orderId
					});
				}
			};
			$('.updateSendThis').on('click', function(){
	            var type = $(this).data('type');
	            var expDetailId = $(this).data('id');
	            var orderId = $(this).data('oid');
	            active[type] && active[type].call(this, orderId, expDetailId);
	        });
			$('.updateReceiverThis').on('click', function(){
	            var type = $(this).data('type');
	            var orderId = $(this).data('oid');
	            active[type] && active[type].call(this, orderId);
	        });
		});
	</script>
</body>
</html>